Below is a C# program that you can run in LINQPad to split a Scribe Online map XML file (with multiple maps in it) to individual map XML files. This is useful for managing Scribe maps in source control. (If there's a better or easier way, let me know.) To export multiple maps in Scribe Online, go to the Maps tab in a solution, highlight the maps, click Export and save the file. You can then run this code (after setting the xml file name) to split the combined Scribe maps file into individual XML files.
// Splits an XML file with multiple Scribe Online maps into individual map XML files.
// Designed to run in LINQPad as a C# Program.
void Main()
{
// TODO: Set the path and file name to the exported Scribe maps xml file.
string exportedScribeMapsFileName = @"C:\Timd\Contoso_Scribe_Maps__DevTest.xml";
// No other changes should be needed. The individual Scribe maps are written to the same folder
// as the file specified above.
string xmlDef = @"<?xml version='1.0' encoding='utf-8'?>";
string xmlRootOpen = @"<ArrayOfSysDefinitionBase xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>";
string xmlRootClose = @"</ArrayOfSysDefinitionBase>";
string newline = Environment.NewLine;
string path = System.IO.Path.GetDirectoryName(exportedScribeMapsFileName) + "\\";
XElement allMaps = XElement.Load(exportedScribeMapsFileName);
IEnumerable<XElement> maps =
from map in allMaps.Elements()
select map;
foreach (XElement map in maps)
{
string mapName = map.Element("Name").Value;
string mapXml = xmlDef + newline + xmlRootOpen + newline + map.ToString() + newline + xmlRootClose;
Console.WriteLine(mapName);
System.IO.File.WriteAllText(path + mapName.Replace(">", "-") + ".xml", mapXml);
}
}
// Splits an XML file with multiple Scribe Online maps into individual map XML files. // Designed to run in LINQPad as a C# Program. void Main() { // TODO: Set the path and file name to the exported Scribe maps xml file. string exportedScribeMapsFileName = @"C:\Timd\Contoso_Scribe_Maps__DevTest.xml"; // No other changes should be needed. The individual Scribe maps are written to the same folder // as the file specified above. string xmlDef = @"<?xml version='1.0' encoding='utf-8'?>"; string xmlRootOpen = @"<ArrayOfSysDefinitionBase xmlns:i='http://www.w3.org/2001/XMLSchema-instance'>"; string xmlRootClose = @"</ArrayOfSysDefinitionBase>"; string newline = Environment.NewLine; string path = System.IO.Path.GetDirectoryName(exportedScribeMapsFileName) + "\\"; XElement allMaps = XElement.Load(exportedScribeMapsFileName); IEnumerable<XElement> maps = from map in allMaps.Elements() select map; foreach (XElement map in maps) { string mapName = map.Element("Name").Value; string mapXml = xmlDef + newline + xmlRootOpen + newline + map.ToString() + newline + xmlRootClose; Console.WriteLine(mapName); System.IO.File.WriteAllText(path + mapName.Replace(">", "-") + ".xml", mapXml); } }